<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class GeneralModel extends CI_Model {

    public $table = 'generals';

    function add($data) {
        $this->db->insert($this->table, $data);
    }

    function update($data, $id) {
        $this->db->where('id', $id);
        return $this->db->update($this->table, $data);
    }
    
    function get() {
        $query = $this->db->query("SELECT * FROM  {$this->table}");
        return $query->result_array();
    }
    
    function getBannerById($id) {
        $query = $this->db->query("SELECT * FROM  {$this->table}
                                    WHERE `id` = {$id}");
        return $query->row_array();
    }
}
?>